<!-- 快递收件货物管理 -->
<template>
<div class="content-box">
  <FilterBox
    :labelWidth="120"
    :filterItemList="filterItemList"
    :filterData="filterData"
    @search="search"
    @clear="clear"
    @keep="keepHeaderList"
  >
  </FilterBox>
  <div class="tabsBox">
    <div @click="leftSlide" class="left-btn border-right">
        <i class="el-icon-d-arrow-left"></i>
    </div>
    <div class="scroll_wrapper" ref="wrapperCon">
      <div class="tabslist">
        <div
          :class="filterData.status === item.id ? 'tabsItem tabs-active' : 'tabsItem'"
          style="padding-right:5px"
          v-for="(item, index) in tabsList"
          :key="index"
          @click="changeTab(item)"
        >
          {{ item.name }}
          <span v-if="item.id!==''&&item.id!==6">（{{item.count}}）</span>
        </div>
      </div>
    </div>
    <div @click="rightSlide" class="right-btn border-left">
        <i class="el-icon-d-arrow-right"></i>
    </div>
  </div>
  <MyTable
    :gridOptions="{checkboxConfig:{checkField: 'checked', trigger: 'row', highlight: true}}"
    :tableColumn="tableColumn"
    :tableData="tableData"
    :isOrder="false"
    @sendCheckBoxList="setCheckBox"
    :rowClassNameFunc="rowClassName"
    >
    <template v-slot:content="scope">
      <span class="moreContant" v-if="!!scope.config.MoreContant">
        <span v-for="(item,k) in scope.config.MoreContant" :key="k">
          <span  v-if="item.length>0">
            <span v-for="(ite,ind) in item" :key="ind">
              <span style="margin-left:5px;">{{ite.label}}:{{scope.row[ite.prop]}}</span>
            </span>
          </span>
          <span v-else>
            <span v-if="item.prop=='merge_num'">
              <span v-if="scope.row.is_merge_package==1">{{item.label}}:{{scope.row[item.prop]}}</span>
            </span>
            <span v-else>{{item.label}}:{{scope.row[item.prop]}}</span>
          </span>
        </span>
      </span>
      <span class="isRemarks" v-else-if="scope.config.prop=='remarks'">{{scope.row[scope.config.prop]}}</span>
      <span class="isRemarks" v-else-if="scope.config.prop=='track_info'">{{scope.row.track_info.desc}}<br>{{scope.row.track_info.track_at}}</span>
      <span v-else>{{ scope.row[scope.config.prop] }}</span>
    </template>
  </MyTable>
  <!-- 分页组件 -->

  <Pagination
    :menuTabsId="filterData.status"
    ref="pagination"
    :currentPage="pageinfo.page"
    :pageSize="pageinfo.limit"
    :total="pageinfo.number_all"
    :page_all="pageinfo.page_all"
    @pagination="SetPagination"
    @sendPushButton="pushButton"
  >
  </Pagination>

  <SignStorage
    @success="getTableData"
    ref="SignStorage"
  ></SignStorage>
  <CoSourcing
    @success="getTableData"
    ref="CoSourcing"
  ></CoSourcing>
  <Edit
    @success="getTableData"
    ref="edit"
  ></Edit>
  <Entry
    @success="getTableData"
    ref="entry"
  ></Entry>
  <SetStatus
    @success="getTableData"
    ref="SetStatus"
  ></SetStatus>
  <TrajectoryQuery
    @success="getTableData"
    ref="TrajectoryQuery"
  ></TrajectoryQuery>
  <TrajectoryAdd
    @success="getTableData"
    ref="TrajectoryAdd"
  ></TrajectoryAdd>
  <BulkOperation
    @success="getTableData"
    ref="BulkOperation"
  ></BulkOperation>
  <Generate
    @success="getTableData"
    ref="generate"
  ></Generate>
  <EnterCarrier
    @success="getTableData"
    ref="enterCarrier"
  ></EnterCarrier>
</div>
</template>
<script>
import SignStorage from "./ExpressCargoManagement_signStorage";
import CoSourcing from "./ExpressCargoManagement_CoSourcing";
import Edit from "./ExpressCargoManagement_edit";
import Entry from "./ExpressCargoManagement_entry";
import SetStatus from "./ExpressCargoManagement_setStatus";
import TrajectoryQuery from "./ExpressCargoManagement_trajectoryQuery";
import TrajectoryAdd from "./ExpressCargoManagement_trajectoryAdd";
import BulkOperation from "./ExpressCargoManagement_bulkOperation";
import Generate from "../ExpressManagenment_Delta/ExpressPackage_generate";
import EnterCarrier from "./ExpressCargoManagement_enterCarrier";
export default {
  components: {
    SignStorage,
    CoSourcing,
    Edit,
    Entry,
    SetStatus,
    TrajectoryQuery,
    TrajectoryAdd,
    BulkOperation,
    Generate,
    EnterCarrier,
  },
  data(){
    return{
      tabsList:[
        {id:0,name:this.$t('ExpressCargoManagementLang.Not_stock'),count:0},
        {id:1,name:this.$t('ExpressCargoManagementLang.Already_stock'),count:0},
        {id:3,name:this.$t('ExpressCargoManagementLang.During_transportation'),count:0},
        {id:4,name:this.$t('ExpressCargoManagementLang.Delivered'),count:0},
        {id:5,name:this.$t('ExpressCargoManagementLang.Delivery_progress'),count:0},
        {id:6,name:this.$t('ExpressCargoManagementLang.Signed_for'),count:0},
        {id:8,name:this.$t('ExpressCargoManagementLang.Pending_refusal_visa'),count:0},
        {id:9,name:this.$t('ExpressCargoManagementLang.Rejected'),count:0},
        {id:10,name:this.$t('ExpressCargoManagementLang.Abandoned_package'),count:0},
        {id:'',name:this.$t('ExpressCargoManagementLang.whole'),count:0},
      ],
      filterItemList:[
        // input输入框
        { label:this.$t('ExpressOrderManagementLang.order_number'),width:200, filterKey: 'order_sn', filterType: 'SearchInput', placeholderStr: null },
        // input输入框
        { label:this.$t('ExpressCargoManagementLang.Package_number'),width:200, filterKey: 'package_sn', filterType: 'SearchInput', placeholderStr: null },
        // input输入框
        { label:this.$t('ExpressCargoManagementLang.Express_Number'),width:200, filterKey: 'express_sn', filterType: 'SearchInput', placeholderStr: null },
        // 下拉框
        { label:this.$t('ExpressOrderManagementLang.line'),width:200, filterKey: 'lid', filterType: 'SearchSelect', placeholderStr: null, filterOptions: {options:[],label:'name_current',value:'lid'} },
        // 日期选择器
        { label:this.$t('ExpressCargoManagementLang.Sign_time'),width:200, filterKey: 'receive_time', filterType: 'SearchDate' },
        // 日期选择器
        { label:this.$t('ExpressCargoManagementLang.Outbound_time'),width:200, filterKey: 'out_time', filterType: 'SearchDate' },
        // 日期选择器
        { label:this.$t('ExpressCargoManagementLang.Yunda_time'),width:200, filterKey: 'trans_finish_time', filterType: 'SearchDate' },
        // 日期选择器
        { label:this.$t('ExpressCargoManagementLang.delivery_goods_time'),width:200, filterKey: 'pickup_time', filterType: 'SearchDate' },
        // input输入框
        { label:this.$t('ExpressCargoManagementLang.Shipper'),width:200, filterKey: 'owner', filterType: 'SearchInput', placeholderStr: null },
        // 下拉框
        { label:this.$t('ExpressCargoManagementLang.destination'),width:200, filterKey: 'target_local', filterType: 'SearchSelect', placeholderStr: null, filterOptions: {options:[],label:'name_current',value:'id'} },
      ],
      filterData:{
        page: "",
        limit: "30",
        order: "",

        type:2,
        
        order_sn: "",
        package_sn: "",
        express_sn: "",
        lid: "",
        receive_time:[],
        receive_time1: "",
        receive_time2: "",
        out_time:[],
        out_time1: "",
        out_time2: "",
        trans_finish_time:[],
        trans_finish_time1: "",
        trans_finish_time2: "",
        pickup_time:[],
        pickup_time1: "",
        pickup_time2: "",
        status:0,
        owner:"",
        target_local:"",
      },
      lineoptions:[],
      localoptionsEnd:[],
      tableColumn: [
        {
          label: "",
          prop: "table_code",
          width:40,
        },
        {
          checked: true,
          label: this.$t('ExpressCargoManagementLang.Package_information'),
          prop: "Package_information_value",
          width: 250,
          MoreContant:[
            {
              label: this.$t('ExpressOrderManagementLang.order_number'),
              prop: "order_sn",
            },
            {
              label: this.$t('ExpressCargoManagementLang.Package_number'),
              prop: "package_sn",
            },
            {
              label: this.$t('ExpressCargoManagementLang.Express_Number'),
              prop: "express_sn",
            },
          ]
        },
        {
          checked: true,
          label: this.$t('ExpressCargoManagementLang.Package_status'),
          prop: "Package_status_value",
          width: 250,
          MoreContant:[
            {
              label: this.$t('ExpressCargoManagementLang.Package_status'),
              prop: "status_name",
            },
            {
              label: this.$t('ExpressCargoManagementLang.Carrier_number'),
              prop: "DispatchNumber",
            },
            {
              label: this.$t('ExpressCargoManagementLang.Face_status'),
              prop: "print_flag_name",
            },
          ]
        },
        {
          checked: false,
          label: this.$t('ExpressOrderManagementLang.Order_status'),
          prop: "Order_status_value",
          width: 200,
          MoreContant:[
            {
              label: this.$t('ExpressOrderManagementLang.Out_bill_status'),
              prop: "out_bill_status_name",
            },
            {
              label: this.$t('ExpressOrderManagementLang.Payment_status'),
              prop: "pay_status_name",
            },
          ]
        },
        // {
        //   checked: true,
        //   label: this.$t('ExpressCargoManagementLang.Shelf_information'),
        //   prop: "Shelf_information_value",
        //   width: 140,
        //   MoreContant:[
        //     {
        //       label: this.$t('ExpressCargoManagementLang.Listing_location'),
        //       prop: "ground_location",
        //     },
        //     {
        //       label: this.$t('ExpressCargoManagementLang.Shelf_number'),
        //       prop: "ground_sn",
        //     },
        //     {
        //       label: this.$t('ExpressCargoManagementLang.Historical_shelf_number'),
        //       prop: "history_ground_sn",
        //     },
        //   ]
        // },
        {
          checked: true,
          label: this.$t('ExpressCargoManagementLang.Route_information'),
          prop: "Route_information_value",
          width: 200,
          MoreContant:[
            {
              label: this.$t('ExpressCargoManagementLang.Line_name'),
              prop: "line_name",
            },
            {
              label: this.$t('ExpressCargoManagementLang.Origin'),
              prop: "start_local_name",
            },
            {
              label: this.$t('ExpressCargoManagementLang.destination'),
              prop: "target_local_name",
            },
          ]
        },
        {
          checked: true,
          label: this.$t('ExpressCargoManagementLang.Shelf_number'),
          prop: "shelves_number",
          width: 100,
        },
        // {
        //   checked: true,
        //   label: this.$t('ExpressCargoManagementLang.Receipt_information'),
        //   prop: "Receipt_information_value",
        //   width: 200,
        //   MoreContant:[
        //     {
        //       label: this.$t('ExpressCargoManagementLang.Shipper'),
        //       prop: "order_uid_examine_name",
        //     },
        //     {
        //       label: this.$t('ExpressCargoManagementLang.Delivery_method'),
        //       prop: "dispatch_type_name",
        //     },
        //     {
        //       label: this.$t('ExpressCargoManagementLang.Sender_name'),
        //       prop: "contact_name",
        //     },
        //     {
        //       label: this.$t('ExpressCargoManagementLang.Sender_phone_number'),
        //       prop: "contact_tel",
        //     },
        //     {
        //       label: this.$t('ExpressCargoManagementLang.Sender_address'),
        //       prop: "contact_addr",
        //     },
        //   ]
        // },
        // {
        //   checked: true,
        //   label: this.$t('ExpressCargoManagementLang.pickup_information'),
        //   prop: "pickup_information_value",
        //   width: 200,
        //   MoreContant:[
        //     {
        //       label: this.$t('ExpressCargoManagementLang.pickup_method'),
        //       prop: "pickup_type_name",
        //     },
        //     {
        //       label: this.$t('ExpressCargoManagementLang.Name_consignee'),
        //       prop: "pickup_name",
        //     },
        //     {
        //       label: this.$t('ExpressCargoManagementLang.pickup_person_phone_number'),
        //       prop: "pickup_tel",
        //     },
        //     {
        //       label: this.$t('ExpressCargoManagementLang.pickup_person_address'),
        //       prop: "pickup_addr",
        //     },
        //   ]
        // },
        {
          checked: true,
          label: this.$t('ExpressCargoManagementLang.Goods_information'),
          prop: "Goods_information_value",
          width: 140,
          MoreContant:[
            {
              label: this.$t('ExpressCargoManagementLang.Product_Name'),
              prop: "goods_name",
            },
            {
              label: this.$t('ExpressCargoManagementLang.Order_Number_packages'),
              prop: "package_num",
            },
            {
              label: this.$t('ExpressCargoManagementLang.Value_goods'),
              prop: "goods_price",
            },
            {
              label: this.$t('ExpressCargoManagementLang.isTrueCoSourcing'),
              prop: "merge_num",
            },
          ]
        },
        {
          checked: true,
          label: this.$t('ExpressCargoManagementLang.Weighing_information'),
          prop: "Weighing_information_value",
          width: 140,
          MoreContant:[
            {
              label: this.$t('ExpressCargoManagementLang.Gross_weight_goods'),
              prop: "gross_weight",
            },
            {
              label: this.$t('ExpressCargoManagementLang.Volume_goods'),
              prop: "volume",
            },
            [
              {
                label: this.$t('ExpressCargoManagementLang.Length'),
                prop: "length",
              },
              {
                label: this.$t('ExpressCargoManagementLang.Width'),
                prop: "width",
              },
              {
                label: this.$t('ExpressCargoManagementLang.Height'),
                prop: "height",
              },
            ]
          ]
        },
        {
          checked: true,
          label: this.$t('ExpressCargoManagementLang.Carg_information'),
          prop: "Carg_information_value",
          width: 140,
          MoreContant:[
            {
              label: this.$t('ExpressCargoManagementLang.Cargo_weighing'),
              prop: "calWeight",
            },
            {
              label: this.$t('ExpressCargoManagementLang.Cargo_volumeing'),
              prop: "cal_volume",
            }
          ]
        },
        {
          checked: true,
          label: this.$t('ExpressCargoManagementLang.Storage_time'),
          prop: "Storage_time_value",
          width: 220,
          MoreContant:[
            {
              label: this.$t('ExpressCargoManagementLang.Sign_time'),
              prop: "upload_at",
            },
            {
              label: this.$t('ExpressCargoManagementLang.Outbound_time'),
              prop: "out_at",
            },
          ]
        },
        {
          checked: true,
          label: this.$t('ExpressCargoManagementLang.Transportation_time'),
          prop: "Transportation_time_value",
          width: 220,
          MoreContant:[
            {
              label: this.$t('ExpressCargoManagementLang.Yunda_time'),
              prop: "trans_finish_at",
            },
            {
              label: this.$t('ExpressCargoManagementLang.delivery_goods_time'),
              prop: "pickup_at",
            },
          ]
        },
        {
          checked: true,
          label: this.$t('ExpressCargoManagementLang.remarks'),
          prop: "remarks",
          width: 220,
        },
        {
          checked: false,
          label: this.$t('ExpressCargoManagementLang.trajectory_info'),
          prop: "track_info",
          width: 220,
        },
        {
          checked: true,
          label: this.$t('ExpressCargoManagementLang.OrderRemarks'),
          prop: "order_remark",
          width: 220,
        },
      ],
      tableData: [],

      pageinfo: {
        page: 1,
        page_all: 1,
        limit: 30,
        number_all: 0,
      },
      sendDataArr:[],//多选框勾选集合
    }
  },
  computed: {
      tabsId() {
          return this.$store.state.tabsId;
      }
  },
  mounted(){
    this.getTabsList()
    this.getHeaderList()
    this.getTableData()
    this.getOptionsList()
  },
  methods:{
    getTabsList(){
      this.$get("packageStatusList", this.filterData).then((res) => {
        this.tabsList = res.data
      });
    },
    // 获取下拉单列表
    async getOptionsList() {
      await this.$get("screenLines",{type:2}).then((res) => {
        this.lineoptions = res.data;
      });
      await this.$get("visibleAddress").then((res) => {
        this.localoptionsEnd = res.data.all_target_local;
      });

      this.filterItemList=[
        // input输入框
        { label:this.$t('ExpressOrderManagementLang.order_number'),width:200, filterKey: 'order_sn', filterType: 'SearchInput', placeholderStr: null },
        // input输入框
        { label:this.$t('ExpressCargoManagementLang.Package_number'),width:200, filterKey: 'package_sn', filterType: 'SearchInput', placeholderStr: null },
        // input输入框
        { label:this.$t('ExpressCargoManagementLang.Express_Number'),width:200, filterKey: 'express_sn', filterType: 'SearchInput', placeholderStr: null },
        // 下拉框
        { label:this.$t('ExpressOrderManagementLang.line'),width:200, filterKey: 'lid', filterType: 'SearchFilterSelect', placeholderStr: null, filterOptions: {options:this.lineoptions,label:'name_current',value:'lid'} },
        // 日期选择器
        { label:this.$t('ExpressCargoManagementLang.Sign_time'),width:200, filterKey: 'receive_time', filterType: 'SearchDate' },
        // 日期选择器
        { label:this.$t('ExpressCargoManagementLang.Outbound_time'),width:200, filterKey: 'out_time', filterType: 'SearchDate' },
        // 日期选择器
        { label:this.$t('ExpressCargoManagementLang.Yunda_time'),width:200, filterKey: 'trans_finish_time', filterType: 'SearchDate' },
        // 日期选择器
        { label:this.$t('ExpressCargoManagementLang.delivery_goods_time'),width:200, filterKey: 'pickup_time', filterType: 'SearchDate' },
        // input输入框
        { label:this.$t('ExpressCargoManagementLang.Shipper'),width:200, filterKey: 'owner', filterType: 'SearchInput', placeholderStr: null },
        // 下拉框
        { label:this.$t('ExpressCargoManagementLang.destination'),width:200, filterKey: 'target_local', filterType: 'SearchSelect', placeholderStr: null, filterOptions: {options:this.localoptionsEnd,label:'name_current',value:'id'} },
      ]
    },
    //查询
    search(){
      this.getTableData()
    },
    //清空
    clear(){
      this.getTabsList()
      this.filterData.order_sn= "",
      this.filterData.package_sn= "",
      this.filterData.express_sn= "",
      this.filterData.lid= "",
      this.filterData.receive_time=[],
      this.filterData.receive_time1= "",
      this.filterData.receive_time2= "",
      this.filterData.out_time=[],
      this.filterData.out_time1= "",
      this.filterData.out_time2= "",
      this.filterData.trans_finish_time=[],
      this.filterData.trans_finish_time1= "",
      this.filterData.trans_finish_time2= "",
      this.filterData.pickup_time=[],
      this.filterData.pickup_time1= "",
      this.filterData.pickup_time2= "",
      this.filterData.owner= "",
      this.filterData.target_local= "",
      this.getTableData()
    },
    // 获取表头组
    getHeaderList(){
      this.$get("get_th",{menu_id:this.tabsId}).then((res) => {
        if(!!res.data.th_json){
          this.tableColumn=JSON.parse(res.data.th_json)
        }
      });
    },
    //保存表头表头组
    keepHeaderList(){
        let params = new FormData();
        params.append("menu_id", this.tabsId);
        params.append("th_json", JSON.stringify(this.tableColumn));
        this.$postForm("save_th", params).then((res) => {
          
        });
    },
    // 更改分页
    SetPagination(data){
      this.filterData.page=data.page
      this.filterData.limit=data.limit
      this.pageinfo.page=data.page
      this.pageinfo.limit=data.limit
      this.getTableData()
    },
    pushButton(route) {
// 签收入库   ：    SignStorage
// 批量入库   :     BatchStorage
// 出库   ：    Outbound
// 批量出库   :     BatchOutbound
// 拒签   ：    denyVisa
// 轨迹查询   ：    TrajectoryQuery
// 轨迹添加   ：    TrajectoryAdd
// 批量轨迹   :     BatchTrajectory
// 轨迹删除   ：    TrajectoryDel
// 到货   ：    transfer
// 批量到货   :      BatchDelivery
// 提货   ：    takeDelivery
// 批量提货   :      BatchPickup
// 派送   ：    dispatch
// 批量派送   :      BatchDispatch
// 签收   ：    SignReceipt
// 批量签收   :     BatchSigning
// 弃货   ：    AbandonedGoods

      if (route == "SignStorage") {
        if (JSON.stringify(this.sendDataArr) == "[]") {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          if(this.sendDataArr.length != 1){
            this.$confirm(this.$t('ExpressCargoManagementLang.sure_cancel_pay'), this.$t('common.prompt'), {
                confirmButtonText: this.$t('common.confirm'),
                cancelButtonText: this.$t('common.cancel'),
            }).then(() => {
                let str=this.sendDataArr.map((obj)=>{return ""+obj.package_sn}).join(",")
                let params = new FormData();
                params.append("packages_sns", str);
                this.$postForm("uploadPackages", params).then((res) => {
                  if(res.success){
                    this.$message.success(res.msg);
                    this.getTableData();
                  }
                });
            }).catch(() => {});
          }else{
            this.$refs.SignStorage.init(this.sendDataArr[0])
          }
        }
      } else if (route == "Outbound") {
        if (JSON.stringify(this.sendDataArr) == "[]") {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.SetStatus.init(this.sendDataArr,'出库')
        }
      } else if (route == "CoSourcing") {
        if (JSON.stringify(this.sendDataArr) == "[]"||this.sendDataArr.length != 1) {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          // if(this.sendDataArr[0].enterprise==1){
            this.$refs.CoSourcing.init(this.sendDataArr[0])
          // }else{
          //   this.$message.warning(this.$t('ExpressCargoManagementLang.message_enterprise_text'));
          // }
        }
      } else if (route == "edit") {
        if (JSON.stringify(this.sendDataArr) == "[]"||this.sendDataArr.length != 1) {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.edit.init(this.sendDataArr[0])
        }
      } else if (route == "print") {
        if (JSON.stringify(this.sendDataArr) == "[]") {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          if(this.sendDataArr[0].enterprise!==0){
            let str=this.sendDataArr.map((obj)=>{return ""+obj.package_sn}).join(",")
            this.$get("orderTickets", {package_sns: str}).then((res) => {
              if(res.data.length>0){
                let params = new FormData();
                params.append("packages_sns", str);
                this.$postForm("upPackagePrint", params).then((res) => {
                  if(res.success){
                    this.getTableData();
                  }
                });
                let routeData = this.$router.resolve({
                  path: "/waybillPrinting",
                  query: { data: JSON.stringify(res.data) },
                });
                window.open(routeData.href, '_blank');  
              }
            });
          }else{
            this.$message.warning(this.$t('ExpressCargoManagementLang.message_print_text'));
          }
        }
      } else if (route == "entry") {
        if (JSON.stringify(this.sendDataArr) == "[]"||this.sendDataArr.length != 1) {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.entry.init(this.sendDataArr[0])
        }
      } else if (route == "denyVisa") {
        if (JSON.stringify(this.sendDataArr) == "[]"||this.sendDataArr.length != 1) {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.SetStatus.init(this.sendDataArr,'拒签')
        }
      } else if (route == "TrajectoryQuery") {
        if (JSON.stringify(this.sendDataArr) == "[]"||this.sendDataArr.length != 1) {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.TrajectoryQuery.init(this.sendDataArr[0])
        }
      } else if (route == "TrajectoryAdd") {
        if (JSON.stringify(this.sendDataArr) == "[]") {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.TrajectoryAdd.init(this.sendDataArr)
        }
      } else if (route == "TrajectoryDel") {
        if (JSON.stringify(this.sendDataArr) == "[]"||this.sendDataArr.length != 1) {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.TrajectoryQuery.init(this.sendDataArr[0],'删除')
        }
      } else if (route == "transfer") {
        if (JSON.stringify(this.sendDataArr) == "[]") {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.SetStatus.init(this.sendDataArr,'到货')
        }
      } else if (route == "takeDelivery") {
        if (JSON.stringify(this.sendDataArr) == "[]") {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.SetStatus.init(this.sendDataArr,'提货')
        }
      } else if (route == "dispatch") {
        if (JSON.stringify(this.sendDataArr) == "[]") {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.SetStatus.init(this.sendDataArr,'派送')
        }
      } else if (route == "SignReceipt") {
        if (JSON.stringify(this.sendDataArr) == "[]") {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.SetStatus.init(this.sendDataArr,'签收')
        }
      } else if (route == "AbandonedGoods") {
        if (JSON.stringify(this.sendDataArr) == "[]") {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.SetStatus.init(this.sendDataArr,'弃货')
        }
      } else if (route == "ConfirmDenyVisa") {
        if (JSON.stringify(this.sendDataArr) == "[]"||this.sendDataArr.length != 1) {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$confirm(this.$t('ExpressCargoManagementLang.ConfirmDenyVisa_text'), this.$t('common.prompt'), {
            confirmButtonText: this.$t('common.confirm'),
            cancelButtonText: this.$t('common.cancel'),
          }).then(() => {
            let str=this.sendDataArr.map((obj)=>{return ""+obj.package_sn}).join(",")
            let params = new FormData();
            params.append("package_sns", str);
            params.append("status", 9);
            this.$postForm("packageStatus", params).then((res) => {
              if(res.success){
                this.$message.success(res.msg);
              }
              this.getTableData()
            })
          }).catch(() => {});
        }
      } else if (route == "CancelDenyVisa") {
        if (JSON.stringify(this.sendDataArr) == "[]"||this.sendDataArr.length != 1) {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$confirm(this.$t('ExpressCargoManagementLang.CancelDenyVisa_text'), this.$t('common.prompt'), {
            confirmButtonText: this.$t('common.confirm'),
            cancelButtonText: this.$t('common.cancel'),
          }).then(() => {
            let str=this.sendDataArr.map((obj)=>{return ""+obj.package_sn}).join(",")
            let params = new FormData();
            params.append("package_sns", str);
            params.append("status", 11);
            this.$postForm("packageStatus", params).then((res) => {
              if(res.success){
                this.$message.success(res.msg);
              }
              this.getTableData()
            })
          }).catch(() => {});
        }
      } else if (route == "export") {
        if(this.tableData.length===0){
          this.$message.warning(this.$t('common.noData'));
          return
        }
        this.$downloadCenterLoad('exportPackageList',this.filterData);
      } else if (route == "BatchStorage") {
        //批量入库
        if(this.tableData.length===0){
          this.$message.warning(this.$t('common.noData'));
          return
        }
        this.$refs.BulkOperation.init(1,this.filterData.status)
      }else if (route == "BatchOutbound") {
        //批量出库
        if(this.tableData.length===0){
          this.$message.warning(this.$t('common.noData'));
          return
        }
        this.$refs.BulkOperation.init(2,this.filterData.status)
      }else if (route == "BatchTrajectory") {
        //批量轨迹
        if(this.tableData.length===0){
          this.$message.warning(this.$t('common.noData'));
          return
        }
        this.$refs.BulkOperation.init(3,this.filterData.status)
      }else if (route == "BatchDelivery") {
        //批量到货
        if(this.tableData.length===0){
          this.$message.warning(this.$t('common.noData'));
          return
        }
        this.$refs.BulkOperation.init(4,this.filterData.status)
      }else if (route == "BatchPickup") {
        //批量提货
        if(this.tableData.length===0){
          this.$message.warning(this.$t('common.noData'));
          return
        }
        this.$refs.BulkOperation.init(5,this.filterData.status)
      }else if (route == "BatchDispatch") {
        //批量派送
        if(this.tableData.length===0){
          this.$message.warning(this.$t('common.noData'));
          return
        }
        this.$refs.BulkOperation.init(6,this.filterData.status)
      }else if (route == "BatchSigning") {
        //批量签收
        if(this.tableData.length===0){
          this.$message.warning(this.$t('common.noData'));
          return
        }
        this.$refs.BulkOperation.init(7,this.filterData.status)
      }else if (route == "generate") {
        //包裹合运单
        this.$refs.generate.init('','快递')
      } else if (route == "enterCarrier") {
        if (JSON.stringify(this.sendDataArr) == "[]"||this.sendDataArr.length != 1) {
          this.$message.warning(this.$t('common.message_warn_text'));
        } else {
          this.$refs.enterCarrier.init(this.sendDataArr[0])
        }
      }
    },
    // 获取表格数据
    getTableData(){
      this.$get("packageList", this.filterData).then((res) => {
        this.tableData = res.data;
        this.pageinfo = res.pageinfo;
        this.pageinfo.limit=Number(this.pageinfo.limit)
        this.sendDataArr=[]
        this.$nextTick(()=>{
          let doms=document.getElementsByClassName('isRemarks')
          if(doms.length>0){
            for(var i=0;i<doms.length;i++){
              doms[i].parentElement.style.whiteSpace='unset'
            }
          }
        })
      });
    },
    // 多选框勾选集合
    setCheckBox(data){
      this.sendDataArr=data
    },
    // 左箭头
    leftSlide() {
        // 保存滚动盒子左侧已滚动的距离
        let left = this.$refs.wrapperCon.scrollLeft;
        let num = 0;
        clearInterval(this.timer);
        this.timer = null;
        this.timer = setInterval(() => {
            //   !left:已经滚动到最左侧
            //   一次性滚动距离（可调节）
            if (!left || num >= 300) {
                // 停止滚动
                clearInterval(this.timer);
                this.timer = null;
                return;
            }
            // 给滚动盒子元素赋值向左滚动距离
            this.$refs.wrapperCon.scrollLeft = left -= 30;
            // 保存向左滚动距离（方便判断一次性滚动多少距离）
            num += 30;
        }, 20);
        // 20：速度（可调节）
    },
    // 右箭头
    rightSlide() {
        // 保存滚动盒子左侧已滚动的距离
        let left = this.$refs.wrapperCon.scrollLeft;
        // 保存元素的整体宽度
        let scrollWidth = this.$refs.wrapperCon.scrollWidth;
        // 保存元素的可见宽度
        let clientWidth = this.$refs.wrapperCon.clientWidth;
        let num = 0;
        clearInterval(this.timer);
        this.timer = setInterval(() => {
            // 已经滚动距离+可见宽度
            // left+clientWidth>=scrollWidth：滚动到最右侧
            // num>=300一次性滚动距离
            if (left + clientWidth >= scrollWidth || num >= 300) {
                clearInterval(this.timer);
                return;
            }
            // 给滚动盒子元素赋值向左滚动距离
            this.$refs.wrapperCon.scrollLeft = left += 30;
            // 保存向左滚动距离（方便判断一次性滚动多少距离）
            num += 30;
        }, 20);
        // 20：速度（可调节）
    },
    changeTab(data) {
      this.filterData.page=1
      this.filterData.status=data.id
      this.$refs.pagination.setSpecialBtn(data.id)
      this.getTableData()
    },
    rowClassName(row){
      if (row.is_merge_package==1) {
        return 'rowStyle'
      }
    },
  }
}
</script>
<style scoped lang="less">
.tableBox {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
/deep/.vxe-cell{
  padding-top: 5px;
  padding-bottom: 5px;
}
.moreContant{
  display: flex;
  flex-direction: column;
  // .tooltip{
  //   display: inline-block;
  //   width: 100%;
  // }
}

.tabsBox {
  margin-bottom: 20px;
    box-sizing: border-box;
    font-size: 14px;
    color: #444;
    display: flex;
    border: 1px solid #f1f1f1;
    cursor: pointer;
    .scroll_wrapper {
        width: calc(100% - 115px);
        overflow-x: scroll;
        margin: 0 5px;
        .tabslist {
            padding: 0 10px;
            height: 100%;
            display: flex;
            align-items: center;
            gap: 10px;
            .tabsItem {
                height: 28px;
                border: 1px solid #ccc;
                box-sizing: border-box;
                border-radius: 4px;
                padding: 5px;
                display: flex;
                justify-content: center;
                align-items: center;
                white-space: nowrap; //禁止文字换行
                position: relative;
                .close-btn {
                    position: absolute;
                    top: 7px;
                    right: 5px;
                    font-size: 14px;
                }
            }
            .tabs-active {
                color: #fff;
                background-color: #6c9ee5 ;
            }
        }
    }
}

.left-btn,
.right-btn {
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}
.border-left {
    border-left: 1px solid #ccc;
}
.border-right {
    border-right: 1px solid #ccc;
}
/*隐藏滚动条*/
.scroll_wrapper::-webkit-scrollbar {
    display: none;
}
.isRemarks{
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
/deep/ .tableBox .vxe-table--render-default .vxe-body--row.rowStyle{
  background-color: #a4d28e;
}
</style>